{include file="common/head"}
</head>

<body style="height:96%;">
    <!--startprint-->
    <div class="container-fluid" style="max-width: 1100px;">
        
        <div  style="margin:0px 0;">
            <div class=" text-center fs-4" style="margin:10px;">
                <img src="/upload/logo.png" style="position: ;left:20px;top:0px;" />
                <c class="text-primary" style="border-bottom: 3px solid #999;">{$sys.copy_right} </c>
                <div class="fs-6" style="margin:-15px 0 15px 0;">
                <div class="text-info text-center">地址 Address：<c style='color:blue'>{$sys.address}</c></div>
                <div class="text-info text-center">电话 Tel.：<c style='color:blue'>{$sys.tel}</c>　　　　Email：<c style='color:blue'>{$sys.email}</c></div>
                </div>
            </div>

            <div class="row" >
                <!-- (送货时填写一式两份，清仓库签收退工厂一份，工厂凭此单结算货款) -->
                <div class="col-6">
                    TO: <c style='color:blue;border-bottom: 0 solid #999;'>{$customer['name']}</c>&nbsp;&nbsp;
                    mobile.：<c style='color:blue'>{$customer.mobile}</c>                </div>
                <div class="col-6" >
                    <c style='color:blue;font-weight: bold;font-size:1.5rem;line-height:24px'>送货单 Delivery Note</c> (收货仓库一份，回执一份)
                </div>
            </div>
        </div>

        <table class="table  table-hover table-bordered" style="border-color:#000">
            <thead class="table-info" style="border-color:#000">
                <th>序号sn</th>
                <th>进仓编号<br />Warehourse</th>
                <th>合同编号Po#</th>
                <th>货号 Item</th>
                <th>名称及规格<br/> Specs</th>
                <th>单件数量 <br />Qty/Pack</th>
                <th>件数<br /> Packages</th>
                <th>数量小计 Qty</th>
                <th style="width:70px;">实收件数</th>
                <th style="width:70px;">实收数</th>
                <th>备注 Remark</th>
            </thead>
            <tbody>
                {foreach $list as $k=>$kv}
                <tr>
                    <td>{$k+1}</td>
                    <td>{$order['in_stock']}</td>
                    <td>{$kv['po']}</td>
                    <td>{$kv['goods_id_name']}</td>
                    <td>{$kv['specs_id_name']} :{$kv['goods_id_desc']}</td>
                    <td class="text-center">{$kv['qty_of_pack']}</td>
                    <td class="text-center ">{$kv['pack_qty']}</td>
                    <td class="text-center ">{$kv['qty']}</td>
                    <td></td>
                    <td></td>
                    <td>{$kv['memo']}</td>
                </tr>
                {/foreach}

                <!-- <tr class="table-info">
                    <td colspan="5"></td>
                    <td>汇总：</td>
                    <td>{}</td>
                    <td>{$num}</td>
                    <td colspan="3"></td>
                </tr> -->
            </tbody>
        </table>


        <div class="row" style="margin-top:50px;">
            <div class="col">发货人 Consignor：{$user['name']}({$delivery_date})</div>
            <div class="col text-center">收货日期 Date:_______________________</div>
        </div>
        <div class="row" style="margin-top:30px;" >
            <div class="col">
                司机 Driver：{$delivery.driver_name}(<span class="bi-phone"></span>{$delivery.driver_mobile})
                ___________________
            </div>
            <div class="col text-center">收货人 Consignee:_______________________</div>

        </div>


    </div>


    <!--endprint-->
    <div class="text-center" style="margin:50px;">
        <button class="btn btn-sm btn-primary" type="button" onclick="printpage();">
            <span class="bi-printer"></span> Print
        </button>

        <button class="btn btn-sm btn-info" type="button" onclick="excel({$delivery.id});">
            <span class="bi-file-excel">Export Excel</span>
        </button>
    </div>

    <div style="height:50px;text-align: center;color:#999"></div>
</body>

<script type="text/javascript">

    $(document).ready(function () {



    })

    function printpage() {
        let oldStr = window.document.body.innerHTML; // 获取body的内容
        let start = "<!--startprint-->"; // 开始打印标识, 17个字符
        let end = "<!--endprint-->"; // 结束打印标识
        let newStr = oldStr.substr(oldStr.indexOf(start) + 17); // 截取开始打印标识之后的内容
        newStr = newStr.substring(0, newStr.indexOf(end)); // 截取开始打印标识和结束打印标识之间的内容
        window.document.body.innerHTML = newStr; // 把需要打印的指定内容赋给body
        window.print(); // 调用浏览器的打印功能打印指定区域
        window.document.body.innerHTML = oldStr; // body替换为原来的内容
    }

    function excel(delivery_id){
        location.href="/order/delivery_list_csv/delivery_id/"+delivery_id;
    }
</script>


</body>

</html>